<template>
	<div class="detail">
		<div class="head">{{ title }}</div>
		<div class="time">{{ createTime }}</div>
		<div class="content" v-html="content"></div>
	</div>
</template>

<script>
import { getCarouselById } from '../../../api/carousel/carousel';
import { getAnnouncementById } from '../../../api/announcements/announcements';
export default {
	async onLoad(options) {
		uni.setNavigationBarTitle({
			title: options.title
		});
		let res=null
		if (options.title === '轮播图详情') {
			res= await getCarouselById(options.id);
			
		} else {
			 res = await getAnnouncementById(options.id);
		}
		const{data:{title,detail,createTime}}=res
		this.title = title;
		this.content = detail;
		console.log(detail)
		this.createTime = createTime;
	},
	data() {
		return {
			title: '标题',
			content: '内容',
			createTime: '2024-12-30 15:21:30'
		};
	}
};
</script>

<style lang="less" scoped>
.detail {
	.head {
		font-size: 40rpx;
		line-height: 90rpx;
		text-align: center;
		height: 90rpx;
	}
	.time {
		height: 40rpx;
		line-height: 40rpx;
		text-align: end;
		padding: 0 40rpx;
	}
	.content {
		height: calc(100vh - 150rpx);
		padding: 5rpx;
	}
}
</style>
